package org.blogwu.learn.designpattern.chapter13.v2;

import java.util.HashMap;
import java.util.Map;

public class ReportFactory {

    private static final Map<String, Report> REPORT_MAP = new HashMap<>();

    public static Report getReport(String reportType) {
        TeamReport teamReport = (TeamReport) REPORT_MAP.get(reportType);
        if (teamReport == null) {
            teamReport = new TeamReport(reportType);
            System.out.print("------创建报表：" + reportType);
            String reportContent = reportType + " 报表内容是：...。。。。";
            teamReport.setEportContent(reportContent);
            System.out.println(reportContent);
            REPORT_MAP.put(reportType, teamReport);
        }
        return teamReport;
    }
}
